CentOS 7
Sponsored Link

OpenStack Liberty : Neutron Networking(GRE)
2015/11/15
 
Configure virtual networking by OpenStack Network Service (Neutron).
For example, configure GRE tunneling type of networking on here.
Before it, Configure basic settings on Control Node, Network Node, Compute Node,
Configure virtual networking like follows which is the same networking environment with VLAN type of example.

                                        |
  +-------------+                  +----+----+
  | Name Server |                  | Gateway |
  +------+------+                  +----+----+
         |10.0.0.10                     |10.0.0.1
         |                              |
         +------------+-----------------+------------------------+
         |            |                 |                        |
         |            |                 |              10.0.0.200-10.0.0.254
     eth0|10.0.0.30   |        10.0.0.50| eth0          +--------+-------+
+--------+---------+  |     +-----------+----------+    | Virtual Router |
| [ Control Node ] |  |     |   [ Network Node ]   |    +--------+-------+
|     Keystone     |  |     |       DHCP Agent     |       192.168.100.1
|      Glance      |  |     |       L3 Agent       |eth1         |            192.168.100.0/24
|     Nova API     |  |     |       L2 Agent       |             |           +-----------------+
|  Neutron Server  |  |     |    Metadata Agent    |             |       +---| Virtual Machine |
+------------------+  |     +----------------------+             |       |   +-----------------+
                      |                                          |       |   +-----------------+
                      |     +----------------------+             +-------+---| Virtual Machine |
                      | eth0|   [ Compute Node ]   |                     |   +-----------------+
                      +-----|     Nova Compute     |                     |   +-----------------+
                   10.0.0.51|       L2 Agent       |                     |---| Virtual Machine |
                            +----------------------+                     |   +-----------------+
                                                                         |   +-----------------+
                                                                         +---| Virtual Machine |
                                                                             +-----------------+
[1] Change settings on Control Node.
[root@dlp ~(keystone)]#
vi /etc/neutron/plugins/ml2/ml2_conf.ini
# near line 8: add vakue for tenant_network_types

tenant_network_types =
gre
# near line 83: add

[ml2_type_gre]
tunnel_id_ranges = 1:1000
[root@dlp ~(keystone)]#
systemctl restart neutron-server

[2] Change settings on Network Node.
# add bridge

[root@network ~]#
ovs-vsctl add-br br-ext

# add eth1 to the port of the bridge above

[root@network ~]#
ovs-vsctl add-port br-ext eth1

[root@network ~]#
vi /etc/neutron/l3_agent.ini
# line 69: add

external_network_bridge =
br-ext
[root@network ~]#
vi /etc/neutron/plugins/ml2/ml2_conf.ini
# near line 8: add vakue for tenant_network_types

tenant_network_types =
gre
# near line 83: add

[ml2_type_gre]
tunnel_id_ranges = 1:1000
[root@network ~]#
vi /etc/neutron/plugins/ml2/openvswitch_agent.ini
# line 2: add (specify IP address of this host for local_ip)

[ovs]
local_ip = 10.0.0.50
enable_tunneling = True
bridge_mappings = external:br-ext
# near line 89: add

[agent]
tunnel_types = gre
[root@network ~]#
systemctl restart neutron-l3-agent neutron-openvswitch-agent

[3] Change settings on Compute Node.
[root@node01 ~]#
vi /etc/neutron/plugins/ml2/ml2_conf.ini
# near line 8: add vakue for tenant_network_types

tenant_network_types =
gre
# near line 83: add

[ml2_type_gre]
tunnel_id_ranges = 1:1000
[root@node01 ~]#
vi /etc/neutron/plugins/ml2/openvswitch_agent.ini
# line 2: add (specify IP address of this host for local_ip)

[ovs]
local_ip = 10.0.0.51
enable_tunneling = True
# near line 88: add

[agent]
tunnel_types = gre
[root@node01 ~]#
systemctl restart neutron-openvswitch-agent

[4] Create a Virtual router. It's OK to work on any node. (This example is on Control Node)
# create a virtual router

[root@dlp ~(keystone)]#
neutron router-create router01

Created a new router:
+-----------------------+--------------------------------------+
| Field                 | Value                                |
+-----------------------+--------------------------------------+
| admin_state_up        | True                                 |
| distributed           | False                                |
| external_gateway_info |                                      |
| ha                    | False                                |
| id                    | 8c37760a-4b8e-4c9e-8d53-3158e44e1c19 |
| name                  | router01                             |
| routes                |                                      |
| status                | ACTIVE                               |
| tenant_id             | d625e02b3d394afbad250def2f88fefa     |
+-----------------------+--------------------------------------+

[root@dlp ~(keystone)]#
Router_ID=`neutron router-list | grep router01 | awk '{ print $2 }'`

[5] Create internal network and associate with the router above.
# create internal network

[root@dlp ~(keystone)]#
neutron net-create int_net

Created a new network:
+---------------------------+--------------------------------------+
| Field                     | Value                                |
+---------------------------+--------------------------------------+
| admin_state_up            | True                                 |
| id                        | 0940cbc6-aa15-483a-ac36-4df923c750a0 |
| mtu                       | 0                                    |
| name                      | int_net                              |
| provider:network_type     | gre                                  |
| provider:physical_network |                                      |
| provider:segmentation_id  | 15                                   |
| router:external           | False                                |
| shared                    | False                                |
| status                    | ACTIVE                               |
| subnets                   |                                      |
| tenant_id                 | d625e02b3d394afbad250def2f88fefa     |
+---------------------------+--------------------------------------+

# create subnet in the internal network

[root@dlp ~(keystone)]#
neutron subnet-create \
--gateway 192.168.100.1 --dns-nameserver 10.0.0.1 int_net 192.168.100.0/24

Created a new subnet:
+-------------------+------------------------------------------------------+
| Field             | Value                                                |
+-------------------+------------------------------------------------------+
| allocation_pools  | {"start": "192.168.100.2", "end": "192.168.100.254"} |
| cidr              | 192.168.100.0/24                                     |
| dns_nameservers   | 10.0.0.1                                             |
| enable_dhcp       | True                                                 |
| gateway_ip        | 192.168.100.1                                        |
| host_routes       |                                                      |
| id                | 772fcfea-1660-45ef-8241-2905bd107d40                 |
| ip_version        | 4                                                    |
| ipv6_address_mode |                                                      |
| ipv6_ra_mode      |                                                      |
| name              |                                                      |
| network_id        | 0940cbc6-aa15-483a-ac36-4df923c750a0                 |
| subnetpool_id     |                                                      |
| tenant_id         | d625e02b3d394afbad250def2f88fefa                     |
+-------------------+------------------------------------------------------+

[root@dlp ~(keystone)]#
Int_Subnet_ID=`neutron net-list | grep int_net | awk '{ print $6 }'`
# set internal network to the router above

[root@dlp ~(keystone)]#
neutron router-interface-add $Router_ID $Int_Subnet_ID

Added interface c28ca272-18a1-4af5-9cf2-de321df8b724 to router 8c37760a-4b8e-4c9e-8d53-3158e44e1c19.
[6] Create external network and associate with the router above.
# create external network

[root@dlp ~(keystone)]#
neutron net-create ext_net --router:external

Created a new network:
+---------------------------+--------------------------------------+
| Field                     | Value                                |
+---------------------------+--------------------------------------+
| admin_state_up            | True                                 |
| id                        | 5ce8e2d6-06a5-48e2-8465-2f642ad85e0f |
| mtu                       | 0                                    |
| name                      | ext_net                              |
| provider:network_type     | gre                                  |
| provider:physical_network |                                      |
| provider:segmentation_id  | 71                                   |
| router:external           | True                                 |
| shared                    | False                                |
| status                    | ACTIVE                               |
| subnets                   |                                      |
| tenant_id                 | d625e02b3d394afbad250def2f88fefa     |
+---------------------------+--------------------------------------+

# create subnet in external network

[root@dlp ~(keystone)]#
neutron subnet-create ext_net \
--allocation-pool start=10.0.0.200,end=10.0.0.254 \
--gateway 10.0.0.1 --dns-nameserver 10.0.0.1 10.0.0.0/24 --disable-dhcp

Created a new subnet:
+-------------------+----------------------------------------------+
| Field             | Value                                        |
+-------------------+----------------------------------------------+
| allocation_pools  | {"start": "10.0.0.200", "end": "10.0.0.254"} |
| cidr              | 10.0.0.0/24                                  |
| dns_nameservers   | 10.0.0.1                                     |
| enable_dhcp       | False                                        |
| gateway_ip        | 10.0.0.1                                     |
| host_routes       |                                              |
| id                | 9c42866c-1157-45dd-afc0-73454388533c         |
| ip_version        | 4                                            |
| ipv6_address_mode |                                              |
| ipv6_ra_mode      |                                              |
| name              |                                              |
| network_id        | 5ce8e2d6-06a5-48e2-8465-2f642ad85e0f         |
| subnetpool_id     |                                              |
| tenant_id         | d625e02b3d394afbad250def2f88fefa             |
+-------------------+----------------------------------------------+

[root@dlp ~(keystone)]#
Ext_Net_ID=`neutron net-list | grep ext_net | awk '{ print $2 }'`

# set gateway to the router above

[root@dlp ~(keystone)]#
neutron router-gateway-set $Router_ID $Ext_Net_ID

Set gateway for router 8c37760a-4b8e-4c9e-8d53-3158e44e1c19
[7] Create and start Virtual machine Instance.
[root@dlp ~(keystone)]#
Int_Net_ID=`neutron net-list | grep int_net | awk '{ print $2 }'`

[root@dlp ~(keystone)]#
nova image-list

+--------------------------------------+---------+--------+--------+
| ID                                   | Name    | Status | Server |
+--------------------------------------+---------+--------+--------+
| 34beed31-2971-43f0-9c5a-d39d3df1d501 | CentOS7 | ACTIVE |        |
+--------------------------------------+---------+--------+--------+

[root@dlp ~(keystone)]#
nova boot --flavor 2 --image CentOS7 --security_group default --nic net-id=$Int_Net_ID CentOS_7

[root@dlp ~(keystone)]#
nova list

+-----------+----------+--------+------------+-------------+-----------------------+
| ID        | Name     | Status | Task State | Power State | Networks              |
+-----------+----------+--------+------------+-------------+-----------------------+
| 028bf570- | CentOS_7 | ACTIVE | -          | Running     | int_net=192.168.100.3 |
+-----------+----------+--------+------------+-------------+-----------------------+
[8] Assign floating IP address to the Instance above.
[root@dlp ~(keystone)]#
neutron floatingip-create ext_net

Created a new floatingip:
+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| fixed_ip_address    |                                      |
| floating_ip_address | 10.0.0.201                           |
| floating_network_id | 5ce8e2d6-06a5-48e2-8465-2f642ad85e0f |
| id                  | de3f08e1-05a9-4571-9154-20a37f192f2e |
| port_id             |                                      |
| router_id           |                                      |
| status              | DOWN                                 |
| tenant_id           | d625e02b3d394afbad250def2f88fefa     |
+---------------------+--------------------------------------+

[root@dlp ~(keystone)]#
Device_ID=`nova list | grep CentOS_7 | awk '{ print $2 }'`

[root@dlp ~(keystone)]#
Port_ID=`neutron port-list -- --device_id $Device_ID | grep 192.168.100.3 | awk '{ print $2 }'`

[root@dlp ~(keystone)]#
Floating_ID=`neutron floatingip-list | grep 10.0.0.201 | awk '{ print $2 }'`

[root@dlp ~(keystone)]#
neutron floatingip-associate $Floating_ID $Port_ID

Associated floating IP de3f08e1-05a9-4571-9154-20a37f192f2e
# confirm settings

[root@dlp ~(keystone)]#
neutron floatingip-show $Floating_ID

+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| fixed_ip_address    | 192.168.100.3                        |
| floating_ip_address | 10.0.0.201                           |
| floating_network_id | 5ce8e2d6-06a5-48e2-8465-2f642ad85e0f |
| id                  | de3f08e1-05a9-4571-9154-20a37f192f2e |
| port_id             | 01d9c16e-983f-4148-9990-3bec994519cd |
| router_id           | 8c37760a-4b8e-4c9e-8d53-3158e44e1c19 |
| status              | ACTIVE                               |
| tenant_id           | d625e02b3d394afbad250def2f88fefa     |
+---------------------+--------------------------------------+
[9] Configure security settings like follows to access with SSH and ICMP.
# permit ICMP

[root@dlp ~(keystone)]#
neutron security-group-rule-create --direction ingress --protocol icmp default

Created a new security_group_rule:
+-------------------+--------------------------------------+
| Field             | Value                                |
+-------------------+--------------------------------------+
| direction         | ingress                              |
| ethertype         | IPv4                                 |
| id                | 03d76de0-7d74-45b1-b19a-174a4c6a04a2 |
| port_range_max    |                                      |
| port_range_min    |                                      |
| protocol          | icmp                                 |
| remote_group_id   |                                      |
| remote_ip_prefix  |                                      |
| security_group_id | 26defc29-1ab4-48ce-a842-f79dd30f2bd5 |
| tenant_id         | d625e02b3d394afbad250def2f88fefa     |
+-------------------+--------------------------------------+

# permit SSH

[root@dlp ~(keystone)]#
neutron security-group-rule-create --direction ingress --protocol tcp --port_range_min 22 --port_range_max 22 default

Created a new security_group_rule:
+-------------------+--------------------------------------+
| Field             | Value                                |
+-------------------+--------------------------------------+
| direction         | ingress                              |
| ethertype         | IPv4                                 |
| id                | ab2df1cf-c052-4ddc-9a06-2a0119ad74ec |
| port_range_max    | 22                                   |
| port_range_min    | 22                                   |
| protocol          | tcp                                  |
| remote_group_id   |                                      |
| remote_ip_prefix  |                                      |
| security_group_id | 26defc29-1ab4-48ce-a842-f79dd30f2bd5 |
| tenant_id         | d625e02b3d394afbad250def2f88fefa     |
+-------------------+--------------------------------------+

[root@dlp ~(keystone)]#
neutron security-group-rule-list

+----------------+----------------+-----------+-----------+---------------+-----------------+
| id             | security_group | direction | ethertype | protocol/port | remote          |
+----------------+----------------+-----------+-----------+---------------+-----------------+
| 03d76de0-7d74- | default        | ingress   | IPv4      | icmp          | any             |
| 66bf77aa-1594- | default        | egress    | IPv6      | any           | any             |
| 8d508297-6157- | default        | ingress   | IPv6      | any           | default (group) |
| ab2df1cf-c052- | default        | ingress   | IPv4      | 22/tcp        | any             |
| c5c0c9ef-0949- | default        | ingress   | IPv4      | any           | default (group) |
| d4145098-f6d2- | default        | egress    | IPv4      | any           | any             |
+----------------+----------------+-----------+-----------+---------------+-----------------+
[10] It's possible to login to the Instance to connect to the IP address with SSH like follows.
[root@dlp ~(keystone)]#
ssh 10.0.0.201

The authenticity of host '10.0.0.201 (10.0.0.201)' can't be established.
ECDSA key fingerprint is 03:3d:a6:2c:21:0d:03:cc:de:29:d1:c0:3b:4d:4c:e7.
Are you sure you want to continue connecting (yes/no)?
yes

Warning: Permanently added '10.0.0.201' (ECDSA) to the list of known hosts.
root@10.0.0.201's password:
Last login: Sat Nov 14 21:10:58 2015
[root@host-192-168-100-3 ~]#    
# just logined
 
Tweet